$primary-color: #1867CA;
$secondary-color: #4C98F1;
$mytext-color: #fff;
$text-color-top: #333333;

.app-header {
    position: relative;
    font-family: 'Source Han Sans CN', sans-serif;

    @media (max-width: 768px) {
        .main-nav {
            display: none;
        }

        .mobile-menu-toggle {
            display: flex;
            position: absolute;
            right: 10px;
            top: 6.6rem;
            z-index: 1000;

            .hamburger {
                width: 25px;
                height: 3px;
                background: $primary-color;
                position: relative;
                transition: all 0.3s;

                &::before,
                &::after {
                    content: '';
                    position: absolute;
                    width: 100%;
                    height: 100%;
                    background: inherit;
                    transition: all 0.3s;
                }

                &::before {
                    transform: translateY(-8px);
                }

                &::after {
                    transform: translateY(8px);
                }

                &.active {
                    background: transparent;

                    &::before {
                        transform: rotate(45deg);
                        background: #1867CA
                    }

                    &::after {
                        transform: rotate(-45deg);
                        background: #1867CA
                    }
                }
            }
        }

        .mobile-menu {
            position: fixed;
            top: 8.4rem;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
            transform: translateX(100%);
            transition: transform 0.3s ease;
            // padding: 20px;

            &.active {
                transform: translateX(0);
            }

            .nav-list {
                background: #fff;

                // width:80%;
                >li {
                    padding: 0 10px;
                    list-style-type: none;

                    // text-align: center;
                    a {
                        color: $primary-color !important;
                        font-size: .95rem;
                        padding: .9rem 0;
                        display: block;
                        border-bottom: 1px solid #eee;
                    }
                }
            }
        }
    }


    .top-bar {
        background: url('/images/top.png') no-repeat center/cover;
        padding: 8px 0;
        // height: 110px;

        .container {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: $text-color-top;
            font-size: 1rem;

            .left {
                span {
                    margin-left: 10px;
                }
            }

            .right {
                display: flex;
                align-items: center;
                gap: 10px;

                .language {
                    margin-right: 20px;
                }

                // .search{
                //     display: flex;
                //     align-items: center;
                //     gap: 10px;
                //     input{
                //         width: 200px;
                //         height: 30px;
                //         border: 1px solid #ccc;
                //         border-radius: 5px;
                //     }
                // }
                .icon {
                    width: 20px;
                    height: 20px;
                }

                span {
                    cursor: pointer;
                }
            }
        }

        .line {
            max-width: 1200px;
            margin: 6px auto 0;
            display: flex;
            justify-content: space-between;
            align-items: center;

            .logo {
                display: block;
            }

            .search {
                display: flex;
                align-items: center;
                position: relative;
                width: 19.25rem;
                height: 2.4rem;
                border: 1px solid #1867CA;
                border-radius: 5px;

                input {
                    border: none;
                    background: transparent;
                    outline: none;
                    padding:0 1rem;
                    color: #333333;
                    width: 100%;
                    font-size: .9rem;
                }

                .icon {
                    position: absolute;
                    right: 10px;
                    top: calc(50% - 1px);
                    width: 40px;
                    transform: translateY(-50%);
                    text-align: right;
                    cursor: pointer;

                    img {
                        width: 20px;
                        vertical-align: -6px;
                    }
                }
            }
        }
    }

    @media screen and (max-width: 768px) {
        .top-bar {
            .line {
                display: block;

                .logo {
                    display: none;
                }

                .search {
                    width: 80%;
                    margin-left: 10px;
                }
            }
        }
    }

    .main-nav {
        background: $primary-color;

        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 12px 0;

            .nav-list {
                display: flex;
                justify-content: space-between;
                list-style: none;
                padding: 0;
                margin: 0;

                >li {
                    position: relative;

                    a {
                        color: $mytext-color;
                        text-decoration: none;
                        padding: 12px 15px;
                        transition: background 0.3s;
                        font-size: 1.1rem;
                        font-weight: bold;

                        &.active {
                            background: #1C77D5;
                        }

                        &:hover {
                            background: #1C77D5;

                        }
                    }

                    .sub-nav {
                        position: absolute;
                        top: 2.3rem;
                        left: 0;
                        width: 100%;
                        background: #fff;
                        border-radius: 0 0 5px 5px;
                        padding: 0;
                        max-height: 0;
                        transform: scaleY(0);
                        transform-origin: top center;
                        transition: max-height 0.3s ease-in-out, transform 0.3s ease-in-out;
                        pointer-events: none;
                        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
                        overflow: hidden;
                        text-align: center;

                        li {
                            a {
                                display: block;
                                padding: 12px 15px;
                                font-size: 1rem;
                                color: #333333;
                                transition: all 0.2s;

                                &:hover {
                                    background: #D9EAFF;
                                    color: $primary-color;
                                }
                            }

                            &:last-child a {
                                border-radius: 0 0 5px 5px;
                            }
                        }
                    }

                    &:hover .sub-nav {
                        max-height: 15rem;
                        transform: scaleY(1);
                        pointer-events: auto;
                    }
                }
            }
        }
    }

    .banner {
        background: url('/images/banner@2x.png') no-repeat center/cover;
        height: 300px;
        display: flex;
        align-items: center;
        justify-content: center;

        .banner-text {
            text-align: center;
            color: $mytext-color;

            // font-family: 'MaShanZheng-Regular', cursive;
            img {
                width: 50%;
            }

            h1 {
                font-size: 30px;
                margin-bottom: 10px;

            }

            p {
                font-size: 14px;
            }
        }
    }

    .login {
        cursor: pointer;

        a {
            color: #1867CA;
        }

        // 添加用户名样式
        span {
            transition: color 0.3s;

            &:nth-child(2) {
                margin: 0 5px;
            }

            &:hover {
                color: #1867CA; // 使用网站主题色
            }
        }
    }
}

@media (max-width: 768px) {
    .app-header {
        .top-bar .container {
            flex-direction: column;
            text-align: center;
            gap: 8px;
        }

        .main-nav .container .nav-list {
            flex-wrap: wrap;
            justify-content: center;
            gap: 5px;
        }

        .banner {
            height: 150px;

            .banner-text {
                h1 {
                    font-size: 18px;
                }

                p {
                    font-size: 12px;
                }
            }
        }
    }
}

@media (min-width: 769px) {
    .mobile-menu {
        display: none !important;
    }
}


// .search {
//     position: relative;
//     width: 300px;

//     input {
//         width: 100%;
//         padding: 8px 40px 8px 15px;
//         border: 1px solid #ddd;
//         border-radius: 20px;
//         transition: all 0.3s;

//         &:focus {
//             border-color: #1890ff;
//             box-shadow: 0 0 5px rgba(24, 144, 255, 0.3);
//         }
//     }

//     .icon {
//         position: absolute;
//         right: 10px;
//         top: calc(50% - 1px);
//         transform: translateY(-50%);
//         cursor: pointer;
//         padding: 5px;
//         transition: opacity 0.3s;

//         &:hover {
//             opacity: 0.8;
//         }

//         img {
//             width: 20px;
//             height: 20px;
//         }
//     }

//     @media (max-width: 768px) {
//         width: 100%;
//         margin-top: 10px;

//         input {
//             padding: 10px 45px 10px 15px;
//         }

//         .icon {
//             right: 5px !important;

//         }
//     }
// }

.highlight {
    color: #1890ff !important;
    background: rgba(24, 144, 255, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
}